<%@ page language="java" pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<%@taglib uri="http://jsptags.com/tags/navigation/pager" prefix="pg"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%--<s:debug></s:debug>
--%>
<html>
	<head>
		<title>团购管理</title>
		<base href="<%=basePath%>">
		<meta http-equiv="Expires" CONTENT="0">
		<meta http-equiv="Cache-Control" CONTENT="no-cache">
		<meta http-equiv="Pragma" CONTENT="no-cache">
		<link rel="stylesheet" type="text/css" href="css/styles.css">
		<script type="text/javascript" src="javascript/jquery.js"
			charset="gb2312"></script>
		<script type="text/javascript" src="javascript/user.js"
			charset="gb2312"></script>
	</head>
	<body class="main">
		<br>
		<br>
		<form action="allGood!toGoodList.action" method="post" name="form1">

			<div class="page_title">
				团购管理
			</div>
			<div class="button_bar">
				<input type="button" class="common_button" onclick="javascript:alert('欢迎使用')"
					value="帮助" />
				<input type="button" class="common_button" onclick="toAdd()"
					value="添加" />
				<input type="button" class="common_button" onclick="query()"
					value="查询" />
			</div>
			<table class="query_form_table" border="0" cellPadding="3"
				cellSpacing="0">
				<tr>
					<th class="input_title">
						商品名称
						<br>
					</th>
					<td class="input_content">
						&nbsp;
						<input value="${requestScope.goodForm.good.goodName}" 
							type="text" name="good.goodName" />
						<br>
					</td>
					<th class="input_title">
						种类
					</th>
					<td class="input_content">
						<s:select list="#{1:'美食',2:'娱乐',3:'旅游酒店',4:'化妆品'}" name="good.goodkind"
						theme="simple" headerKey="0" headerValue="全部"></s:select>
						
					</td>
				</tr>
			</table>
			<!-- 列表数据 -->
			<br />
			<table class="data_list_table" border="0" cellPadding="3"
				cellSpacing="0">
				<tr>
					<th class="data_title" style="width: 10%;"
						onclick="order_by('proId');">
						编号
					</th>
					<th class="data_title" style="width: 15%;"
						onclick="order_by('proName');">
						商品名称
					</th>
					<th class="data_title" style="width: 15%;"
						onclick="order_by('proPrice');">
						价格
					</th>
					<th class="data_title" style="width: 20%;"
						onclick="order_by('proStartTime');">
						开始时间
					</th>
					<th class="data_title" style="width: 20%;"
						onclick="order_by('proEndTime');">
						结束时间
					</th>					
					<th class="data_title">
						操作
					</th>
				</tr>
               	<s:if test="#request.SPB.size()==0">
					<tr>
						<td class="data_cell" colspan="20"
							style="text-align: center; height: 40px;">
							暂时还没有记录
						</td>
					</tr>
				</s:if>
				<s:else>
					<s:iterator value="#request.SPB.datas" status="status" id="good1">
					<tr>
						<td class="data_cell" style="text-align: right; padding: 0 10px;">
							<s:property value="#status.index+1"/>
						</td>
						<td class="data_cell" style="text-align: center;">
							<s:property value="goodName"/>
						</td>
						<td class="data_cell">
							<s:property value="goodPrice"/>
						</td>						
						<td class="data_cell">
							<s:property value="startTime"/>
						</td>
						<td class="data_cell">
							<s:property value="endTime"/>
						</td>
						<td class="data_cell">
							<img class="op_button" onclick="detail(${good1.goodId})"
								src="images/bt_detail.gif" title="查看" />
							<img class="op_button" onclick="del(${good1.goodId},'${good1.goodName}')" 
							    src="images/bt_del.gif" title="删除" />			
							<img class="op_button" onclick="toedit(${good1.goodId})"
								src="images/bt_edit.gif" title="编辑" />
						</td>
					</tr>
				  </s:iterator>
					<tr>
						<th colspan="100" class="pager">

							<div class="pager">
                                <pg:pager url="allGood!toGoodList.action" maxPageItems="4" maxIndexPages="6" items="${requestScope.SPB.total}" export="currentPageNumber=pageNumber">
									<pg:first>
										<a href="${pageUrl}">首页</a>
									</pg:first>
									<pg:prev>
										<a href="${pageUrl}">上一页</a>
									</pg:prev>
									
									<pg:pages>
										<s:if test="#attr.currentPageNumber==#attr.pageNumber">
											<font color="red">${pageNumber}</font>
										</s:if>
										<s:else>
											<a href="${pageUrl}">${pageNumber }</a>
										</s:else>
										
										
									</pg:pages>
									
									<pg:next>
										<a href="${pageUrl}">下一页</a>
									</pg:next>
									<pg:last>
										<a href="${pageUrl}">尾页</a>
									</pg:last>
								</pg:pager>
								
							</div>
						</th>
					</tr>
				
				</s:else>
			
				
			</table>
			
			
		</form>
	</body>
</html>
